layui.use(function () {
    let form = layui.form;
    let table = layui.table;
    let $ = layui.jquery;
    let layer = layui.layer;

    table.render({
        elem: '#view_comments',
        url: '/comment/findComment',
        page: true,
        height: '500px',
        cols: [
            [
                {
                    field: 'id',
                    title: "编号",
                    align: 'center',
                    sort: true
                },
                {
                    field: 'username',
                    title: "用户名",
                    align: 'center',
                    templet: function (d) {
                        if (d.isAnonymous == 1) {
                            return '匿名用户';
                        } else {
                            return d.username;
                        }
                    }
                },
                {
                    field: 'theme',
                    title: "主题",
                    align: 'center'
                },
                {
                    field: 'time',
                    title: "时间",
                    align: 'center'
                },
                {
                    field: 'content',
                    title: '内容',
                    align: "center"
                }
            ]
        ],
        limits: [1, 3, 5, 7, 9],
        limit: 3,
        done: function (res, curr, count) {
            $("[lay-id='view_comments']>.layui-table-page").css({
                "text-align": "center"
            });
        }
    });

});